package junior.sample.test.demo.model.enums;

import junior.db.annotation.IEnumValue;

import java.util.Arrays;

/**
 * @author wubo
 * @date 2024/9/14 15:32
 */
public enum GenderEnum implements IEnumValue<Integer> {
    NONE(0, "保密"),
    
    MALE(1, "男"),
    
    FEMALE(2, "女");
    
    private Integer value;
    private String desc;
    
    GenderEnum(Integer value, String desc) {
        this.value = value;
        this.desc = desc;
    }
    
    public String getDesc() {
        return desc;
    }
    
    
    public Integer getValue() {
        return value;
    }
    
    public static GenderEnum ofValue(Integer integer) {
        return Arrays.stream(GenderEnum.values()).filter(item -> item.getValue().equals(integer)).findFirst().orElse(null);
    }
    
}
